﻿using SSAT.Utils;

namespace SSAT.Commands
{
    internal sealed class CloseConnectionCommand : CommandBase
    {
        public override string DisplayName
        {
            get
            {
                return CommandsResources.CloseConnectionCommandDisplayName;
            }
        }

        private readonly Action _closeMethod;

        public CloseConnectionCommand(Action closeMethod)
        {
            Verification.CheckArgumentForNull(closeMethod, "closeMethod");
            _closeMethod = closeMethod;
        }

        public override void Execute()
        {
            if (_closeMethod != null)
            {
                _closeMethod.Invoke();
            }
        }
    }
}
